/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MainWindow.java
 *
 * Created on Jun 8, 2011, 10:49:51 AM
 */

package org.amityregion5.projectx;

/**
 *
 * @author Joe Stein
 * @author Daniel Centore
 */
public class MainWindow extends javax.swing.JFrame {
    public static final long serialVersionUID = 522L;

    /** Creates new form MainWindow */
    public MainWindow()
    {
        initComponents();
        getRootPane().setDefaultButton(clientBtn);
        this.setVisible(true);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents()
    {

        jLabel1 = new javax.swing.JLabel();
        clientBtn = new javax.swing.JButton();
        serverBtn = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Ubuntu", 1, 24)); // NOI18N
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("project x");

        clientBtn.setText("Join a Game");
        clientBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                clientBtnActionPerformed(evt);
            }
        });

        serverBtn.setText("Start a Server");
        serverBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                serverBtnActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addComponent(clientBtn, javax.swing.GroupLayout.DEFAULT_SIZE, 207, Short.MAX_VALUE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(serverBtn)).addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE)).addContainerGap()));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jLabel1).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(clientBtn, javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE).addComponent(serverBtn, javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE)).addContainerGap()));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void serverBtnActionPerformed(java.awt.event.ActionEvent evt)// GEN-FIRST:event_serverBtnActionPerformed
    {// GEN-HEADEREND:event_serverBtnActionPerformed
        org.amityregion5.projectx.server.Main.main(new String[0]);
        this.dispose();
    }// GEN-LAST:event_serverBtnActionPerformed

    private void clientBtnActionPerformed(java.awt.event.ActionEvent evt)// GEN-FIRST:event_clientBtnActionPerformed
    {// GEN-HEADEREND:event_clientBtnActionPerformed
        org.amityregion5.projectx.client.main.Main.load();
        this.dispose();
    }// GEN-LAST:event_clientBtnActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[])
    {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run()
            {
                new MainWindow().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton clientBtn;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JButton serverBtn;
    // End of variables declaration//GEN-END:variables

}
